function showListMenu() {
    var listMenu = document.getElementById("list-menu");
    listMenu.style.display = "block";
}

function hideListMenu() {
    var listMenu = document.getElementById("list-menu");
    listMenu.style.display = "none";
}

function showLogInfo() {
    var logInfo = document.getElementById("log-info");
    var style = document.defaultView.getComputedStyle(logInfo, null);
    if (style.display == "none") {
        logInfo.style.display = "block";
    } else {
        logInfo.style.display = "none";
    }
}

function showQrCode() {
    var qrCode = document.getElementById("show-qr-code");
    var style = document.defaultView.getComputedStyle(qrCode, null);
    if (style.display == "none") {
        qrCode.style.display = "block";
    } else {
        qrCode.style.display = "none";
    }
}

function showControlInfo() {
    var controlInfo = document.getElementById("control-i-info");
    controlInfo.style.display = "block";
}

function hideControlInfo() {
    var controlInfo = document.getElementById("control-i-info");
    controlInfo.style.display = "none";
}

function showShareLog() {
    var shareLog = document.getElementById("share-log-list");
    var style = document.defaultView.getComputedStyle(shareLog, null);
    if (style.display == "none") {
        shareLog.style.display = "block";
    } else {
        shareLog.style.display = "none";
    }
}

var index = 4;

function fadeInPre() {
    var picture = $(".pic-show");
    if (index == 0) {
        index = 5;
    }
    picture.eq(index - 1).fadeIn(2000).siblings().fadeOut(2000);
    index--;
}

function fadeInAft() {
    var picture = $(".pic-show");
    if (index == 4) {
        index = -1;
    }
    picture.eq(index + 1).fadeIn(2000).siblings().fadeOut(2000);
    index++;
}

function changeSlidePre() {
    var slidePic = $("#pic-show-place");
    slidePic.animate({
        left: "-=1200px"
    }, "fast", function() {
        if (slidePic.css('left') == "-3600px") {
            slidePic.css('left', 0);
        }
    });
}

function changeSlideAft() {
    var slidePic = $("#pic-show-place");
    if (slidePic.css("left") == "auto" || slidePic.css("left") == "0px") {
        slidePic.css("left", "-3600px");
    }
    slidePic.animate({
        left: "+=1200px"
    }, "fast");
}

function up_down() {
    var change = $("#slide-pic");
    var height = change.css('height');
    var changeUpDown = $("#slide-pic-left a");
    if (height == "175px") {
        change.css('height', '85px').animate({
            top: "+=90px"
        });
        changeUpDown.css('background-position-x', '-33px');
    } else {
        change.css('height', '175px');
        change.animate({
            top: "-=90px"
        });
        changeUpDown.css('background-position-x', '-16px');
    }
}

var flag = 1;

function changeLog(num) {
    var shareLog = $(".connection-logo");
    var shareLogx;
    flag = num;
    shareLogx = (num - 1) * (-19) + "px";
    shareLog.css('background-position-x', shareLogx);
    switch (num) {
        case 1:
            openwindow('http://service.weibo.com/share/share.php?title=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B', 650, 572);
            break;
        case 2:
            openwindow('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&summary=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6&url=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&pics=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg', 656, 719);
            break;
        case 3:
            openwindow('http://widget.renren.com/dialog/share?resourceUrl=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&title=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&description=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6&pic=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg', 700, 680);
            break;
        case 4:
            openwindow('http://www.douban.com/share/service?href=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&name=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&image=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg&text=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6', 770, 546);
            break;
        case 5:
            openwindow('http://share.v.t.qq.com/index.php?c=share&a=index&title=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6&placeholder=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&url=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&pic=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg', 658, 545);
            break;
    }
}

function openwindow(url, iWidth, iHeight) {
    var url;
    var name = "分享你的喜悦";
    var iWidth;
    var iHeight;
    var iTop = (window.screen.height - iHeight) / 2;
    var iLeft = (window.screen.width - iWidth) / 2;
    window.open(url, name, 'height=' + iHeight + ',,innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}

function linkShare() {
    switch (flag) {
        case 1:
            openwindow('http://service.weibo.com/share/share.php?title=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B', 650, 572);
            break;
        case 2:
            openwindow('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&summary=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6&url=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&pics=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg', 656, 719);
            break;
        case 3:
            openwindow('http://widget.renren.com/dialog/share?resourceUrl=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&title=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&description=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6&pic=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg', 700, 680);
            break;
        case 4:
            openwindow('http://www.douban.com/share/service?href=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&name=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&image=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg&text=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6', 770, 546);
            break;
        case 5:
            openwindow('http://share.v.t.qq.com/index.php?c=share&a=index&title=%23%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE%23%E6%98%9F%E5%9E%8B%E5%9F%8E%E5%B8%82%EF%BC%8C%E5%90%AC%E8%B5%B7%E6%9D%A5%E6%9C%89%E4%BA%9B%E4%BB%A4%E4%BA%BA%E9%9A%BE%E4%BB%A5%E7%BD%AE%E4%BF%A1%EF%BC%8C%E6%88%96%E8%AE%B8%E6%98%AF%E4%B8%8A%E5%B8%9D%E9%81%97%E7%95%99%E5%9C%A8%E4%BA%BA%E9%97%B4%E7%9A%84%E4%B8%80%E9%A2%97%E6%98%9F%E6%98%9F%E5%90%A7%E2%80%A6&placeholder=%E5%BF%85%E5%BA%94%E7%BE%8E%E5%9B%BE&url=http%3A%2F%2Fcn.bing.com%2F%3Fform%3DHPSWCN&pic=http%3A%2F%2Fscp-social.s-msn.com%2Fs%2Fimages%2Fbinghp%2Fzh-cn%2Ffortbourtange_zh-cn9788197909_1920x1080.jpg', 658, 545);
            break;
    }
}

var myDate;
var nowDate;
var nowTime;
var oldTime;
var timer;
var anchor;
var anchorInfo;
var myflag = 0;

function myGetTime() {
    timer = setInterval(function() {
        myDate = new Date();
        nowTime = myDate.getTime();
    }, 1000);
    setInterval(function() {
        var screenWidth = document.body.clientWidth;
        var anchors = $("#container");
        if (screenWidth < 945) {
            if (myflag == 0)
                anchors.removeAttr('onmousemove');
            else
                anchors.unbind('mousemove');
            myflag = 2;
        } else if (myflag == 2) {
            anchors.mousemove('showAnchor()');
            myflag = 1;
        }
    }, 1000);
}

function showAnchor() {
    clearInterval(timer);
    nowDate = new Date();
    oldTime = nowDate.getTime();
    anchor = $(".anchor");
    anchorInfo = $(".anchor-info");
    anchor.each(function() {
        $(this).fadeIn(1000);
    });
    anchorInfo.each(function() {
        $(this).fadeOut(300);
    });
    timer = setInterval(function() {
        myDate = new Date();
        nowTime = myDate.getTime();
        if (nowTime - oldTime >= 2000) {
            anchor.each(function() {
                $(this).fadeOut(1000);
            });
        }
    }, 1000);
}

function showAnchorInfo(myi) {
    var i;
    clearInterval(timer);
    window.event.cancelBubble = true;
    anchor = $(".anchor");
    anchorInfo = $(".anchor-info");
    $(this).show();
    for (i = 0; i < 15; i++) {
        if (i == myi) {
            continue;
        } else {
            anchor.eq(i).fadeOut(300);
        }
    }
    anchorInfo.eq(myi).fadeIn(1000);
}

function keepAnchorInfo(myi) {
    clearInterval(timer);
    window.event.cancelBubble = true;
    anchor = $(".anchor");
    anchor.eq(myi).show();
    $(this).css('display', 'block');
}

function hideSetting() {
    var setting = $("#setting-web");
    setting.animate({
        "left": "-=1349"
    }, 1000, function() {
        setting.css('left', '0px');
        setting.css('display', 'none');
    });
}

function showSetting() {
    var setting = $("#setting-web");
    setting.slideDown(1000);
}
